{
  "version": "1.1",
  "description": "Flexible rules for variable P&L layouts",

  "allowed_sheets": ["P&L", "Inputs", "Assumptions"],

  "sheets": {
    "P&L": {
      "period_structure": {
        "type": "columns",
        "start_column": "B",
        "end_column": "M"
      },

      "line_items": {
        "Revenue": {
          "type": "sum",
          "label_match": "Revenue",
          "label_column": "A",
          "range_mode": "between_labels",
          "range_start_label": "Revenue",
          "range_end_label": "Cost of Goods Sold",
          "sign": "positive"
        },

        "Cost of Goods Sold": {
          "type": "sum",
          "label_match": "Cost of Goods Sold",
          "label_column": "A",
          "range_mode": "between_labels",
          "range_start_label": "Cost of Goods Sold",
          "range_end_label": "Gross Profit",
          "sign": "negative"
        },

        "Gross Profit": {
          "type": "derived",
          "label_match": "Gross Profit",
          "label_column": "A",
          "formula_expectation": "Revenue - Cost of Goods Sold"
        },

        "Operating Expenses": {
          "type": "sum",
          "label_match": "Operating Expenses",
          "label_column": "A",
          "range_mode": "between_labels",
          "range_start_label": "Operating Expenses",
          "range_end_label": "Operating Profit",
          "sign": "negative"
        },

        "Operating Profit": {
          "type": "derived",
          "label_match": "Operating Profit",
          "label_column": "A",
          "formula_expectation": "Gross Profit - Operating Expenses"
        },

        "Net Profit": {
          "type": "derived",
          "label_match": "Net Profit",
          "label_column": "A",
          "formula_expectation": "Operating Profit + Other Income + Other Expenses"
        }
      }
    }
  }
}
